<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="resources/css/stylemain.css">
<link rel="stylesheet" href="resources/layui/css/layui.css">
<link rel="stylesheet" href="resources/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
<style>
	
	.layui-table-view .layui-form-radio>i {
	    margin-top: 15px !important;
	    font-size: 20px;
	}

	.layui-form-radio>i:hover {
	    color: #5FB878;
	    margin-top: 15px !important;
	}
	
	.layui-form-radioed>i {
	    color: #5FB878;
	    margin-top: 15px !important;
	}
</style>
</head>
<body>
<table class="layui-hide" id="tbl_users" lay-filter="tbl_users"></table>
<script type="text/javascript" src="resources/js/jquery.min.js"></script>
<script src="resources/layui/layui.all.js"></script>

<script type="text/javascript">
var table = layui.table;
layui.use([], function(){
		 
});

function child(user,orgid){
	getUserList(user,orgid);
}

function getUserList(susers,orgid){
	var datastring = '{"orgid":"' + orgid + '","mtype":0}';
	$.ajax({
		type:"post",
		contentType: "application/json;charset=UTF-8",
		url: "getUserNamelist2.do?",
		data:datastring,
		async:false,
     	dataType:"json",
        success: function(msg) {    //数据提交成功时返回数据
        	//debugger;
        	if(msg.status == "1"){
        		table.render({
        			  elem: '#tbl_users'
        			  ,cellMinWidth: 50
        			  , limit: Number.MAX_VALUE
        			  ,cols: [[
        				  {type:'radio', hide: false}
        				,{field:'oper_reals', title: '姓名', width:100}
        			    ,{field:'username', title: '用户名', width:120}         			     
        			    ,{field:'rolename', title: '角色', width:160} 
        			    
        			  ]]
        			  ,data:msg.datas
        			  ,height: '486'
        			});	        		
        		
        	}else{
        		layer.msg(msg.desc);
        	}						
        },        
        error : function(e){
            alert(e.status);
            alert(e.responseText);
        }

	});
	debugger;
   	if(susers != []){
   		var mydiv = $(":contains('"+ susers[0].oper_reals +"')").parent()[8].children[0].children[0].children[0];

        var $my=$(mydiv);
        $my.next('div').click();
   	}
}

function getCheckedUsers(){
	//debugger;
	var checkStatus = table.checkStatus('tbl_users');
	var data = checkStatus.data;
	return data;
}

table.on('row(tbl_users)', function(obj){
    var data = obj.data;    
    obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
	//选中radio样式
	obj.tr.find('i[class="layui-anim layui-icon"]').trigger("click");
});
//监听表格选择
table.on('checkbox(tbl_users)', function(obj){
	debugger;
    var mtr=obj.tr;
    var dx = obj.tr.children("td").children("div").children("div");
    var $dx =$(dx);
    if(obj.checked==true){
        $(mtr).css("color","green");
        $dx.addClass('layui-form-checked');

    }else{
        $(mtr).css("color","black");
        $dx.removeClass('layui-form-checked');
    }

});

</script>

</body>
</html>
